package msu.ml.data;

import java.util.*;
/**
 * The IPulseVolume interface contains
 * methods for accessing data in a
 * pulse volume.
 *
 * @author Reginald M Mead
 * @version 1.0
 */
public class DynamicPulseVolume implements IPulseVolume
{
    private ArrayList<String> featureNames;
    private ArrayList<Double> features;

    public DynamicPulseVolume()
    {
        featureNames = new ArrayList<String>();
        features = new ArrayList<Double>();
    }

    public void addFeature(String name, double value)
    {
        featureNames.add(name);
        features.add(value);
    }

    /**
     * Returns the names of the features
     * stored in this pulse volume.
     *
     * @return an array of feature names
     */
    public String [] getFeatureNames()
    {
        return featureNames.toArray(new String [0]);
    }

    /**
     * returns the actual values of the
     * features stored in this pulse volume.
     *
     * @return an array of feature values
     */
    public double [] getFeatures()
    {
        double [] result = new double[features.size()];
        for(int i = 0; i < features.size(); i++)
        {
            result[i] = features.get(i).doubleValue();
        }
        return result;
    }
}
